This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Repository navigation
Generalize Buffer.BlockCopy optimization for either src or dst - #4736
Merged
Merged
Conversation
Member
|
I have never seen Buffer.BlockCopy usage pattern like this. Do you have any examples of code where this helps? Checking for a special case - that pretty much never happens - is making the code slower for everybody else. It is net loss - not making any real world workload faster. |
Author
|
@jkotas Sure, it's one of the top answers on Besides (correct me if I'm wrong) I don't think this is adding any overhead to the cases where this optimization doesn't apply. |
Member
|
I see. LGTM. Thanks! |
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
…t/coreclr#4736) * Generalize Buffer.BlockCopy optimization for either src or dst Commit migrated from dotnet/coreclr@32e44ef
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Don't have that much experience in native programming, but here it goes...
I noticed from #3118 that an optimization was added in the case where both
srcanddstwere byte arrays, but not when only one of them was. Therefore, the optimization would not apply to code like this:This PR changes that so the optimization runs if either the
srcordstarrays is a byte array, otherwise falling back to the default implementation as usual.cc @jkotas